import fs from "fs-extra";
import path from "path";

/**
 * 奇葩游戏专用修改器。
 */
export class QiPaModifier {
    public async modify(exportRoot: string): Promise<void> {
        console.log('modify qipa project...');
        const mainAndroidManifest = path.join(exportRoot, 'unityLibrary/src/main/AndroidManifest.xml');
        const content = await fs.readFile(mainAndroidManifest, 'utf-8');
        const newContent = content.replace('android.intent.action.MAIN', 'com.super.sdk.MAIN').replace('android.intent.category.LAUNCHER', 'android.intent.category.DEFAULT');
        await fs.writeFile(mainAndroidManifest, newContent, 'utf-8');
    }
}